﻿using System;

namespace AMS.Inventory.Entities
{
    /// <summary>
    /// 资产台账对象
    /// </summary>
    public class LedgerInfo : AbstractInventoryProperty
    {
        protected Guid m_Id;

        /// <summary>
        /// 数据唯一标识
        /// </summary>
        public virtual Guid Id
        {
            get { return m_Id; }
            set { m_Id = value; }
        }

        /// <summary>
        /// 重写Equals方法
        /// </summary>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, this))
                return true;
            if (obj == null)
                return false;
            var sObj = obj as LedgerInfo;
            return sObj != null && (sObj.Barcode == m_Barcode || sObj.Id==m_Id);
        }

        /// <summary>
        /// 重写GetHashCode方法
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 177;
            hash = 15*hash*Barcode.GetHashCode();
            return hash;
        }

        /// <summary>
        /// 重写ToString方法
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return m_Barcode;
        }
    }
}